Tear up static 'comport' after a CloseFile on it.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 21 Sep 2004 02:14:46 +0000 (02:14 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 21 Sep 2004 02:14:46 +0000 (02:14 +0000)
gpsbabel/jeeps/gpsserial.c

index 31345fe3aee4941a55d771ff96230dc76418e1fe..31d99860ceca11e5678031bfb1ce762935882ace 100644 (file)
@@ -123,6 +123,7 @@ int32 GPS_Serial_On(const char *port, int32 *fd)
        if (!SetCommState (comport, &tio)) {
                GPS_Serial_Error("SetCommState");
                CloseHandle(comport);
+               comport = INVALID_HANDLE_VALUE;
                gps_errno = SERIAL_ERROR;
                return 0;
        }
@@ -142,6 +143,7 @@ int32 GPS_Serial_On(const char *port, int32 *fd)
        if (!SetCommTimeouts (comport, &timeout)) {
                GPS_Serial_Error("SetCommTimeouts");
                CloseHandle (comport);
+               comport = INVALID_HANDLE_VALUE;
                gps_errno = SERIAL_ERROR;
                return 0;
        }
@@ -155,6 +157,7 @@ int32 GPS_Serial_Off(const char *port, int32 fd)
                gusb_close(port);
        } else {
                CloseHandle(comport);
+               comport = INVALID_HANDLE_VALUE;
        }
        return 1;
 }